﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_frmAdTaoDeThi : System.Web.UI.Page
{
    clsTaoDeThi taodethi = new clsTaoDeThi();
    protected void Page_Load(object sender, EventArgs e)
    {
        btnThem.Attributes.Add("onclick", "return kiemtranhap();");
       //drlQuytac.SelectedIndex = 1;
      // drlQuytac.SelectedIndex = 0;
        
       //DetailsView1.DataBind();
       
        
    }
    protected void btnThem_Click(object sender, EventArgs e)
    {
        DateTime datetime = new DateTime();
        
        datetime = Convert.ToDateTime(txtDateTimePicker.Text);
        string tendethi = txtTenDT.Text.Trim();
        //string mamon = drlTenmon.SelectedValue;
        string maloptc = drlmaloptc.SelectedItem.Text.Trim();
        string maqt = drlQuytac.SelectedItem.Text.Trim();
        taodethi.ThemDeThi(maqt, tendethi,maloptc,datetime);

        //te.sp_LayRDCH(3, "madtcr", "Kho");
        taodethi.TaoDeThi( maqt);
        GridView1.DataBind();
    }

    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //txtMaDe.Text = GridView1.SelectedRow.Cells[1].Text;
        txtTenDT.Text = GridView1.SelectedRow.Cells[4].Text;
        drlQuytac.SelectedItem.Text = GridView1.SelectedRow.Cells[2].Text;
        drlTenmon.SelectedItem.Text = GridView1.SelectedRow.Cells[3].Text;
    }

    protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
    {
        txtTenDT.Text = GridView1.SelectedRow.Cells[4].Text;
        drlQuytac.SelectedItem.Text = GridView1.SelectedRow.Cells[2].Text;
        drlTenmon.SelectedItem.Text = GridView1.SelectedRow.Cells[3].Text;
    }
    protected void drlTenmon_SelectedIndexChanged(object sender, EventArgs e)
    {
        

    }
    protected void drlQuytac_SelectedIndexChanged(object sender, EventArgs e)
    {
        //DetailsView1.DataBind();
    }
}
